/**
 * @Author:周邱艳
 * @Date:2020/6/30
 * @Description:这是首页的宫格
 */
import React,{Component} from "react";
import { Grid,Icon } from 'antd-mobile';
import icon1 from "../../../access/images/recommand.png"
import icon2 from "../../../access/images/bestchoice.png"
import icon3 from "../../../access/images/ranking.png"

export default class HomeGrid extends Component{
    constructor(props) {
        super(props);
        this.onGridClick=this.onGridClick.bind(this)
    }
    onGridClick(el){
        if (el.text==='推荐组合'){
            this.props.history.push('/recommendProducts')
        }else if(el.text==='排行榜'){
            this.props.history.push('/rankProducts')
        }else {
            localStorage.setItem("tabs",1)
            this.props.history.push('/terran/product')
        }
    }
    render() {
        return (
            <div >
            <Grid
                data={[
                {icon: icon1, text: '推荐组合'},
                {icon: icon3, text: '排行榜'},
                {icon: icon2, text: '产品优选'},
            ]}
                columnNum={3}
                hasLine={false}
                itemStyle={{height:"8rem"}}
                onClick={this.onGridClick}
            />
            </div>
        );
    }
}

